#include "main.h"

#include "test/MagNumTestCase.h"
#include "test/TestSuite.h"

CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MagNumTestCase, "MagNumTestCase" );

CppUnit::Test *suite1();
CppUnit::Test *suite2();

#include <iostream>
using namespace std;

int main(int argc, char* argv[]) {

	// if command line contains "-selftest" then this is the post build check
	// => the output must be in the compiler error format.
	bool selfTest = (argc > 1) && (std::string("-selftest") == argv[1]);

	CppUnit::TextUi::TestRunner runner;
	runner.addTest(suite1()); // Add the top suite to the test runner
//	runner.addTest(suite2()); // Add the top suite to the test runner


	if (selfTest) { // Change the default outputter to a compiler error format outputter
		// The test runner owns the new outputter.
		runner.setOutputter(
				CppUnit::CompilerOutputter::defaultOutputter(&runner.result(),
						std::cerr));
	}

	// Run the test.
	bool wasSucessful = runner.run("");

	// Return error code 1 if any tests failed.
	return wasSucessful ? 0 : 1;
}
